<template>
	<div class="userBg">
		<div class="banjiList">
			<div class="item" v-for="(item,index) in banjiList" :key="index" @click="changeBanji(item.banji)">
				{{item.banji}}
			</div>
		</div>
		<div class="loadingBox" v-if="showLoading">
			<image src="https://www.baixuemianshi.com/zhuanti/tingkezheng/images/loading.gif" mode="widthFix"></image>
		</div>
		
		
	</div>
</template>

<script>
	import {
		mapActions
	} from 'vuex';
	const db = wx.cloud.database()
	export default {
		data() {
			return {
				banjiList:[]
			}
		},
		onLoad(options) {
			
		},
		onReady() {
			
		},
		computed: {
			userphone() {
				return this.$store.getters.userphone ? this.$store.getters.userphone : '';
			}
		},
		created() {
			let that = this;
			this.getBanjiInfo()
			
		},
		mounted() {
			let that = this 
			
		},
		watch: {
			
		},
		methods: {
			...mapActions(['LogSetPhone','LogSetOpenid']),
			
			getopenid() {
				let that = this
				wx.cloud.callFunction({
					name: 'getopenid',
					data: {},
					complete: res => {
						wx.setStorageSync("useropenid", res.result.openid)
						that.openid = res.result.openid
					}
				})
			},
			getBanjiInfo() {
				let that = this
				db.collection('nbhd_tiku_banjilist').where({
					phone: that.userphone
				}).get({
					success: res => {
						console.log(res)
						that.banjiList = res.data
					}
				})
			},
			getqingjiauser(){
				let that = this
				db.collection('24gk_tkzinfo').where({
					banji: that.banjiInfo.banji
				}).get({
					success: res => {
						console.log(res)
					}
				})
			},
			getTime(){
				let that = this
				let day = new Date()
				let y = day.getFullYear()
				let m = (day.getMonth() + 1).toString().padStart(2, '0');
				let d = day.getDate().toString().padStart(2, '0');
				let hour = day.getHours().toString().padStart(2, '0');
				let miu = day.getMinutes().toString().padStart(2, '0');
				let time = y + '-' + m + '-' + d + ' ' + hour + ':' + miu
				return time
			},
			changeBanji(banji){
				let that = this
				uni.navigateTo({
					url:'./list?banji=' + banji
				})
			}
		},
		components: {
			
		}
	};
</script>

<style scoped>
	@import url(./index.css);
</style>